<?php
  require("konf.php");
  $yhendus=new mysqli($masin, $kasutaja, $parool, $baas);
  if(isSet($_REQUEST["makstud_id"])){
     $kask=$yhendus->prepare("UPDATE mikrobussivedu SET arveseisund=2 WHERE id=?");
	 $kask->bind_param("i", $_REQUEST["makstud_id"]);
	 $kask->execute();
  }
  $kask=$yhendus->prepare("SELECT id,  kliendinimi, juhinimi FROM mikrobussivedu WHERE arveseisund=1");
  $kask->bind_result($id, $kliendinimi, $juhinimi);
  $kask->execute();
  require("p2is.php");
  
  ?>
    <h1>Arvete maksmise kinnitamine</h1>
	<h2>Maksmata arved</h2>
	<ul>
	  <?php
	     while($kask->fetch()){
		   echo "<li>$kliendinimi, $juhinimi<a href='?makstud_id=$id'>Makstud</a></li>";
		 }
	  ?>
	</ul>
<?php
  $yhendus->close();
  require("jalus.php");
?>